---
title: GitHub Actions
---

## Sample GitHub Actions Workflow

```yaml
name: ParadeDB in GitHub Actions

on:
  pull_request:
    branches:
      - main
  workflow_dispatch:

jobs:
  paradedb-in-github-actions:
    name: ParadeDB in GitHub Actions
    runs-on: ubuntu-latest

    services:
      paradedb:
        # The list of available tags can be found at https://hub.docker.com/r/paradedb/paradedb/tags
        image: paradedb/paradedb:latest
        env:
          POSTGRES_USER: testuser
          POSTGRES_PASSWORD: testpassword
          POSTGRES_DB: testdb
        ports:
          - 5432:5432
        options: >-
          --health-cmd="pg_isready -U postgres"
          --health-interval=10s
          --health-timeout=5s
          --health-retries=5

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Wait for PostgreSQL to be ready
        run: |
          for i in {1..10}; do
            if psql -h localhost -U testuser -d testdb -c "SELECT 1;" > /dev/null 2>&1; then
              echo "Database is ready!"
              break
            fi
            echo "Waiting for database..."
            sleep 5
          done

      - name: Run ParadeDB example queries
        run: |
          psql -h localhost -U testuser -d testdb -c "CALL paradedb.create_bm25_test_table(schema_name => 'public', table_name => 'mock_items');"
          psql -h localhost -U testuser -d testdb -c "SELECT description, rating, category FROM mock_items LIMIT 3;"
          psql -h localhost -U testuser -d testdb -c "CREATE INDEX search_idx ON mock_items USING bm25 (id, description, category, rating, in_stock, created_at, metadata, weight_range) WITH (key_field='id');"
          psql -h localhost -U testuser -d testdb -c "SELECT description, rating, category FROM mock_items WHERE description @@@ 'shoes' OR category @@@ 'footwear' AND rating @@@ '>2' ORDER BY description LIMIT 5;"
```
